app.controller('RtTicketsCtrl', function ($scope, $filter) {

    $scope.day = $filter('date')(new Date(), 'yyyyMMdd');

    $scope.reload = $scope.page.loader('res/rt/' + $scope.day + '/{pageIndex}/{pageSize}/pools');
    $scope.$on('pageIndex', function (event, p) { $scope.reload(p); });
    $scope.reload(1);

    $scope.queryMap = {};
    $scope.query = function () {
        if ($scope.queryMap.date) {
            $scope.day = $filter('date')($scope.queryMap.date, 'yyyyMMdd');
        } else {
            delete $scope.queryMap.date;
            $scope.day = $filter('date')(new Date(), 'yyyyMMdd');
        }
        $scope.reload = $scope.page.loader('res/rt/' + $scope.day + '/{pageIndex}/{pageSize}/pools');
        $scope.reload(1);
    };

});